package com.googlecode.moneyManager.model;


import javax.persistence.*;
import java.util.Calendar;

/**
 * Author: Sergiy Doroshenko
 * Date: Apr 26, 2010
 * Time: 11:07:32 PM
 */
@Entity
public class SecurityValue extends BaseEntity{
    private Calendar date;
    private Amount amount;
    private TypeSecurityValue type;

    public SecurityValue(){}

    @OneToOne(cascade = CascadeType.ALL)
    public Amount getAmount() {
        return amount;
    }

    public void setAmount(Amount amount) {
        this.amount = amount;
    }

    @Column(nullable = false)
    public Calendar getDate() {
        return date;
    }

    public void setDate(Calendar date) {
        this.date = date;
    }

    @Column(nullable = false)
    @Enumerated(EnumType.ORDINAL)
    public TypeSecurityValue getType() {
        return type;
    }

    public void setType(TypeSecurityValue type) {
        this.type = type;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("SecurityValue");
        sb.append("{date=").append(date);
        sb.append(", amount=").append(amount);
        sb.append(", type=").append(type);
        sb.append('}');
        return sb.toString();
    }
}
